const formatDate = (timesTamp, type) => {
	var timesTamp = timesTamp ? timesTamp : new Date().getTime();
	var _date = new Date(timesTamp);
  var paddingStr = function (_str) {
    return _str.length == 1 ? "0" + _str : _str
  }	
	var week = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
  var _yyyy = _date.getFullYear();
	var _MM = _date.getMonth() + 1 + '';
	_MM = paddingStr(_MM);
	var _dd = _date.getDate() + "";
	_dd = paddingStr(_dd);
	var _hh = _date.getHours() + "";
	_hh = paddingStr(_hh);
  var _mm = _date.getMinutes() + ""
  _mm = paddingStr(_mm)	
	var _week = week[_date.getDay()]
	switch (type) {
		case '0':
			return `${_yyyy}-${_MM}-${_dd} ${_hh}:${_mm}`;
			break;
		case '1':
			return [_yyyy, _MM, _dd, _week, _hh, _mm]
			break;
		case '2':
			return `${_hh}:${_mm}`;
			break;
		case '3':
			return `${_MM}月${_dd}日${_hh}:${_mm}`;
			break;								
	}
}
export {
  formatDate
}
